package smartcampus.scjava.utils.talk.util;

import cn.hutool.core.io.resource.ClassPathResource;

import javax.swing.*;
import java.io.InputStream;

public class GetImg {


    public static ImageIcon getImgIcon(String imgName){
        ClassPathResource classPathResource = new ClassPathResource(imgName);
        InputStream is = classPathResource.getStream();
        ImageIcon imgIcon = null;
        byte b[] = new byte[2048*1024];
        try {
            is.read(b);
        }catch (Exception e){
            e.printStackTrace();
            imgIcon = new ImageIcon(imgName);
        }
        imgIcon = new ImageIcon(b);
        return imgIcon;
    }
}
